package com.ruoyi.management_controller.RepresentingAppearance.service.impl;

import java.util.List;

import com.ruoyi.management_controller.liaison_station.StreetInfo.domain.StreetInfo;
import com.ruoyi.management_controller.liaison_station.StreetInfo.mapper.StreetInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.management_controller.RepresentingAppearance.mapper.RepresentingAppearanceMapper;
import com.ruoyi.management_controller.RepresentingAppearance.domain.RepresentingAppearance;
import com.ruoyi.management_controller.RepresentingAppearance.service.IRepresentingAppearanceService;

/**
 * 代表风采Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-07-07
 */
@Service
public class RepresentingAppearanceServiceImpl implements IRepresentingAppearanceService 
{
    @Autowired
    private RepresentingAppearanceMapper representingAppearanceMapper;

    @Autowired
    private StreetInfoMapper streetInfoMapper;

    /**
     * 查询代表风采
     * 
     * @param id 代表风采主键
     * @return 代表风采
     */
    @Override
    public RepresentingAppearance selectRepresentingAppearanceById(String id)
    {
        return representingAppearanceMapper.selectRepresentingAppearanceById(id);
    }

    /**
     * 查询代表风采列表
     * 
     * @param representingAppearance 代表风采
     * @return 代表风采
     */
    @Override
    public List<RepresentingAppearance> selectRepresentingAppearanceList(RepresentingAppearance representingAppearance)
    {
        return representingAppearanceMapper.selectRepresentingAppearanceList(representingAppearance);
    }

    /**
     * 新增代表风采
     * 
     * @param representingAppearance 代表风采
     * @return 结果
     */
    @Override
    public int insertRepresentingAppearance(RepresentingAppearance representingAppearance)
    {
        StreetInfo streetInfo=streetInfoMapper.selectStreetInfoById(representingAppearance.getStreetId());
        representingAppearance.setStreet(streetInfo.getStreetName());
        return representingAppearanceMapper.insertRepresentingAppearance(representingAppearance);
    }

    /**
     * 修改代表风采
     * 
     * @param representingAppearance 代表风采
     * @return 结果
     */
    @Override
    public int updateRepresentingAppearance(RepresentingAppearance representingAppearance)
    {
        StreetInfo streetInfo=streetInfoMapper.selectStreetInfoById(representingAppearance.getStreetId());
        representingAppearance.setStreet(streetInfo.getStreetName());
        return representingAppearanceMapper.updateRepresentingAppearance(representingAppearance);
    }

    /**
     * 批量删除代表风采
     * 
     * @param ids 需要删除的代表风采主键
     * @return 结果
     */
    @Override
    public int deleteRepresentingAppearanceByIds(String[] ids)
    {
        return representingAppearanceMapper.deleteRepresentingAppearanceByIds(ids);
    }

    /**
     * 删除代表风采信息
     * 
     * @param id 代表风采主键
     * @return 结果
     */
    @Override
    public int deleteRepresentingAppearanceById(String id)
    {
        return representingAppearanceMapper.deleteRepresentingAppearanceById(id);
    }
}
